package com.twu.biblioteca;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class ResultsLoggedIn implements Results{
	
	public void reserveBookResult(BibliotecaApp app, Books book, Users user)
	{
		try{
			System.out.println("\nEnter the name of book you want to reserve:");
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String name = br.readLine();
			if(book.reserveBook(name))
			{
				System.out.println( "Thank You! Enjoy the book.\n");
			}
			else
			{
				System.out.println("Sorry, this book is already issued.\n");
			}
		}
		catch(Exception ex)
		{
			System.out.println("Sorry we don't have that book yet.\n");
		}
	}
	
	public void userDetailsResult(BibliotecaApp app, Users user, String username)
	{
		user.displayUserDetails(username);
	}
	
	public void moviesDetailsResult(BibliotecaApp app, Movies movie, Users user)
	{
		try{
			System.out.println("\nEnter the name of the movie, you want details: ");
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String name = br.readLine();
			if(movie.getMovies().containsKey(name))
			{
				movie.displayMoviesDetails(name);
			}
			else
			{
				System.out.println("Sorry, we do not have the listings for this movie.\n");
			}
		}
		catch(Exception ex)
		{
			System.out.println("Sorry we don't have that book yet.\n");
		}
	}

}
